﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Client Customize Validation.aspx.cs"
    Inherits="Client_Customize_Validation" %>

<%@ Register Assembly="Cwing.UI.Validation" Namespace="Cwing.UI.Controls" TagPrefix="cwvf" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    </div>
    <cwvf:ErrorList ID="ErrorList1" runat="server">
    </cwvf:ErrorList>
    <p>
        <input id="Button1" type="button" value="button" onclick="javascript:gvInstance().Validate();" /></p>
    <select id="sfas">
        <option value="11">sdfdsfs</option>
        <option value="22">22</option>
        <option value="33">33</option>
        <option value="44">44</option>
        <option value="55">55</option>
    </select>
    <script type="text/javascript">
        var cv = new CustomizeValidation("<%=ErrorList1.ClientID %>");
        cv.Validate = function(r){
            if(r){
                var obj = document.getElementById("sfas");
                if(obj.value != "55"){
                    this.Message = "This is a customize validatio" + this.UniqueID;
                    return false;
                }
                else
                    return true;
            }
            else{
                alert(r);
            }
        }
        gvInstance().AddCustomizeValidation(cv);
    </script>
    <asp:CheckBox ID="CheckBox1" runat="server" />
    <cwvf:ValidationTextBox ID="ValidationTextBox1" runat="server" Type="Client" 
        ValidationSummary="ErrorList1"></cwvf:ValidationTextBox>
    </form>
</body>
</html>